package com.health.controller;

import com.health.constant.ResultCodeConstant;
import com.health.pojo.dto.CreateGroup;
import com.health.pojo.dto.RestResult;
import com.health.pojo.dto.SystemLogDTO;
import com.health.service.SystemLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.Boolean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统日志管理
 *
 * @author WUYU_MIN
 * @date 2025-04-29 23:51:18
 */
@Tag(name = "系统日志管理")
@RequestMapping("systemLog")
@RestController
public class SystemLogController {

    @Autowired
    private SystemLogService systemLogService;

    /**
     * 记录用户操作日志: 将用户操作日志保存到数据库
     *
     * @param systemLogDTO 用户操作日志入参对象
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @Operation(summary = "记录用户操作日志: 将用户操作日志保存到数据库")
    @ResponseBody
    public RestResult<Boolean> addSystemLog(@RequestBody @Validated(CreateGroup.class) SystemLogDTO systemLogDTO) {
        Boolean result = systemLogService.addSystemLog(systemLogDTO);
        return new RestResult<>(ResultCodeConstant.CODE_000000, ResultCodeConstant.CODE_000000_MSG, result);
    }
}
